package com.zxd.iostream;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

/**
 * ClassName:TestByteStream
 * Package:com.zxd.iostream
 * 字节输入输出流
 *
 * @Date:2023/10/9 18:09
 * @Author:zxde
 */
public class TestByteStream {
    public static void main(String[] args) throws IOException {
        File file = new File("logout.txt");
        FileInputStream fileInputStream = new FileInputStream(file);

        //一次性读取整个文件进入数组，避免乱码
        byte[] bytes = new byte[(int) file.length()];
        fileInputStream.read(bytes);
        System.out.println(new String(bytes));
    }

}
